package jk.spider.core.storage.impl;

import jk.spider.core.storage.CheckInfoDAO;
import jk.spider.core.storage.FolderDAO;
import jk.spider.core.storage.ImgInfoDAO;
import jk.spider.core.storage.ProxyDAO;
import jk.spider.core.storage.ResInfoDAO;
import jk.spider.core.storage.ResourceDAO;
import jk.spider.core.storage.SinfoDAO;
import jk.spider.core.storage.Storage;
import jk.spider.util.config.PropertySet;

public class StorageImpl implements Storage {
	protected ResourceDAO resourceDAO;
	protected ResInfoDAO resInfoDAO;
	protected FolderDAO folderDAO;
	protected ImgInfoDAO imgInfoDAO;
	protected SinfoDAO sinfoDAO;
	protected CheckInfoDAO checkInfoDAO;
	protected ProxyDAO proxyDAO;
	protected DAOHelp daoHelp;
	
	public StorageImpl(PropertySet props) {
		 daoHelp = new DAOHelp(props);
		 this.init();
	}
	
	public StorageImpl(String dbUrl) {
		 daoHelp = new DAOHelp(dbUrl);
		 this.init();
	}
	
	private void init () {
		 resourceDAO = new ResourceDAOImpl(this,daoHelp);
		 resInfoDAO = new ResInfoDAOImpl(daoHelp);
		 folderDAO = new FolderDAOImpl(daoHelp);
		 sinfoDAO = new SinfoDAOImpl(daoHelp);
		 checkInfoDAO = new CheckInfoDAOImpl(daoHelp);
		 imgInfoDAO = new ImgInfoDAOImpl(daoHelp);
		 proxyDAO = new ProxyDAOImpl(daoHelp);
	}
	
	public FolderDAO getFolderDAO() {
		return folderDAO;
	}

	public ImgInfoDAO getImgInfoDAO() {
		return imgInfoDAO;
	}

	public ResourceDAO getResourceDAO() {
		return resourceDAO;
	}

	public ResInfoDAO getResourceInfoDAO() {
		return resInfoDAO;
	}

	public SinfoDAO getSinfoDAO() {
		return sinfoDAO;
	}
	
	public CheckInfoDAO getCheckInfoDAO() {
		return checkInfoDAO;
	}
	
	public ProxyDAO getProxyDAO() {
		return proxyDAO;
	}
	
	public DAOHelp getDAOHelp() {
		return daoHelp;
	}

}
